﻿using System;
using System.Collections.Generic;

using System.Text;

namespace Estimate.Common.Repository
{
    /// <summary>
    /// 根据用户指定的名称，生成相应的Fore表
    /// </summary>
    public class ForeRepositoryFactory
    {
        /// <summary>
        /// 城镇预报数据库操作类
        /// </summary>
        public static ForeRepository NormalCityForeRepository(string connectionString)
        {
            return new ForeRepository(connectionString, "Normal_CityFore");
        }

        /// <summary>
        /// 国家局下发预报数据库操作类
        /// </summary>
        public static ForeRepository ZytCityForeRepository(string connectionString)
        {
            return new ForeRepository(connectionString, "Zyt_CityFore");
        }

        /// <summary>
        /// 市代县预报数据库操作类
        /// </summary>
        public static ForeRepository SdxCityForeRepository(string connectionString)
        {
            return new ForeRepository(connectionString, "Sdx_CityFore");
        }

        /// <summary>
        /// 省台指导预报数据库操作类
        /// </summary>
        public static ForeRepository StSiteForeRepository(string connectionString)
        {
            return new SiteForeRepository(connectionString, "St_SiteFore");
        }

        /// <summary>
        /// 个人及集体指导站预报数据库操作类
        /// </summary>
        public static ForeRepository SiteForeRepository(string connectionString,string name)
        {
            ForeRepository result = new SiteForeRepository(connectionString, string.Format("{0}_SiteFore", name));
            if(!result.IsTableExist())
                result.CreateTable();
            return result;
        }

        /// <summary>
        /// 降水等值线预报数据库操作类
        /// </summary>
        public static ForeRepository RainForeRepository(string connectionString)
        {
            ForeRepository result = new ForeRepository(connectionString, "RainFore");
            if (!result.IsTableExist())
                result.CreateTable();
            return result;
        }
    }
}
